package trunk.backend;

import java.util.ArrayList;

public class HTMLComboBox extends HTMLElement {
	private String name, label;
	private ArrayList<String> options;
	private ArrayList<String> values;
	
	public HTMLComboBox(String name, String label, ArrayList<String> options, ArrayList<String> values) {
		this.name = new String(name);
		this.label = new String(label);
		this.options = new ArrayList<String>(options);
		this.values = new ArrayList<String>(values);
	}

	public String toHTML() {
		String comboBox = new String(label + "\n");
		
		comboBox += "<select name=\"" + name + "\">\n";
		for (int i = 0; i < options.size(); i++) {
			comboBox += "<option value=\"" + values.get(i) + "\"> ";
			comboBox += options.get(i) + "\n";
		}
		comboBox += "</select>\n";
		return comboBox;
	}

}
